package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpYAccountUserProfileContactDetailsTabPageUtil extends SeleniumPageUtil {

	public final static By UPCD_SPAN_HEADER = By.id("ctl44_ParentChildContainer_UserProfile_ContactDetails1_hdrMain_lblHeader");
	public final static By UPCD_LINK_SAVE = By.xpath("//*[@id='1200b7b1-84c1-4249-ac08-f3eef101e3a8']/a");
	
	public final static By UPCD_TD_ADDRESS_1 = By.xpath("//*[@id='ctl44_ParentChildContainer_PnlChildControl']/table[2]/tbody/tr/td[1]/table/tbody/tr[1]/td[1]");
	public final static By UPCD_INPUT_ADDRESS_1 = By.id("ctl44_ParentChildContainer_UserProfile_ContactDetails1_ctrlAddressEdit_txtAddress1");
	public final static By UPCD_TD_ADDRESS_2 = By.xpath("//*[@id='ctl44_ParentChildContainer_PnlChildControl']/table[2]/tbody/tr/td[1]/table/tbody/tr[2]/td[1]");
	public final static By UPCD_INPUT_ADDRESS_2 = By.id("ctl44_ParentChildContainer_UserProfile_ContactDetails1_ctrlAddressEdit_txtAddress2");
	public final static By UPCD_TD_ADDRESS_3 = By.xpath("//*[@id='ctl44_ParentChildContainer_PnlChildControl']/table[2]/tbody/tr/td[1]/table/tbody/tr[3]/td[1]");
	public final static By UPCD_INPUT_ADDRESS_3 = By.id("ctl44_ParentChildContainer_UserProfile_ContactDetails1_ctrlAddressEdit_txtAddress3");
	public final static By UPCD_TD_ADDRESS_4 = By.xpath("//*[@id='ctl44_ParentChildContainer_PnlChildControl']/table[2]/tbody/tr/td[1]/table/tbody/tr[4]/td[1]");
	public final static By UPCD_INPUT_ADDRESS_4 = By.id("ctl44_ParentChildContainer_UserProfile_ContactDetails1_ctrlAddressEdit_txtAddress4");
	public final static By UPCD_TD_CITY = By.xpath("//*[@id='ctl44_ParentChildContainer_PnlChildControl']/table[2]/tbody/tr/td[1]/table/tbody/tr[5]/td[1]");
	public final static By UPCD_INPUT_CITY = By.id("ctl44_ParentChildContainer_UserProfile_ContactDetails1_ctrlAddressEdit_txtCity");
	public final static By UPCD_TD_STATE = By.xpath("//*[@id='ctl44_ParentChildContainer_PnlChildControl']/table[2]/tbody/tr/td[1]/table/tbody/tr[6]/td[1]");
	public final static By UPCD_INPUT_STATE = By.id("ctl44_ParentChildContainer_UserProfile_ContactDetails1_ctrlAddressEdit_txtState");
	public final static By UPCD_TD_ZIP = By.xpath("//*[@id='ctl44_ParentChildContainer_PnlChildControl']/table[2]/tbody/tr/td[1]/table/tbody/tr[7]/td[1]");
	public final static By UPCD_INPUT_ZIP = By.id("ctl44_ParentChildContainer_UserProfile_ContactDetails1_ctrlAddressEdit_txtZip");
	public final static By UPCD_TD_COUNTRY = By.xpath("//*[@id='ctl44_ParentChildContainer_PnlChildControl']/table[2]/tbody/tr/td[1]/table/tbody/tr[8]/td[1]");
	public final static By UPCD_INPUT_COUNTRY = By.id("ctl44_ParentChildContainer_UserProfile_ContactDetails1_ctrlAddressEdit_txtCountry");
	public final static By UPCD_TD_OFFICE = By.xpath("//*[@id='ctl44_ParentChildContainer_PnlChildControl']/table[2]/tbody/tr/td[1]/table/tbody/tr[9]/td[1]");
	public final static By UPCD_INPUT_OFFICE = By.id("ctl44_ParentChildContainer_UserProfile_ContactDetails1_ctrlAddressEdit_txtPhone");
	public final static By UPCD_TD_FAX = By.xpath("//*[@id='ctl44_ParentChildContainer_PnlChildControl']/table[2]/tbody/tr/td[1]/table/tbody/tr[10]/td[1]");
	public final static By UPCD_INPUT_FAX = By.id("ctl44_ParentChildContainer_UserProfile_ContactDetails1_ctrlAddressEdit_txtFax");
	public final static By UPCD_TD_MOBILE = By.xpath("//*[@id='ctl44_ParentChildContainer_PnlChildControl']/table[2]/tbody/tr/td[1]/table/tbody/tr[11]/td[1]");
	public final static By UPCD_INPUT_MOBILE = By.id("ctl44_ParentChildContainer_UserProfile_ContactDetails1_ctrlAddressEdit_txtMobile");
	
	public static void enterUserProfileContactDetailsTabPage(){
		SpYAccountUserProfileDefaultPageUtil.enterYourAccountUserProfileDefaultPage();
		SeleniumUtil.click(SeleniumUtil.getCachedElement(SpYAccountUserProfileDefaultPageUtil.YAUP_TAB_CONTACT_DETAILS));
		waitForContactDetailsPageToLoad();
	}
	
	public static void waitForContactDetailsPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				UPCD_LINK_SAVE, UPCD_TD_MOBILE, UPCD_INPUT_OFFICE,UPCD_INPUT_OFFICE
			});
		
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(UPCD_LINK_SAVE));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(UPCD_INPUT_MOBILE));
	}
}
